package com.googlecode.mylyn.core.client;

import javax.annotation.Nonnull;

import org.eclipse.core.runtime.CoreException;
import org.eclipse.mylyn.tasks.core.IRepositoryListener;
import org.eclipse.mylyn.tasks.core.TaskRepository;

/**
 * Keeps track of {@link IGoogleCodeClient}s associated with {@link TaskRepository}s.
 */
public interface IGoogleCodeClientManager extends IRepositoryListener {

    /**
     * Returns the {@link IGoogleCodeClient} associated with a given
     * {@link TaskRepository}. Creates a new {@link IGoogleCodeClient} if there isn't
     * already one. Attention, this method may to IO.
     *
     * @category IO
     * @param repository the repository, not {@literal null}
     * @return the {@link IGoogleCodeClient} associated with {@code repository}, never
     *    {@literal null}
     * @throw CoreException if the task repository has invalid credentials
     */
    IGoogleCodeClient getClient(@Nonnull TaskRepository repository) throws CoreException;

}
